<!DOCTYPE html>

<html lang="en">

<head>
    <meta charset="UTF-8">
    <title>注册</title>
    <!-- 使用boot strap和font awrsome -->
    <link rel="stylesheet" href="/static/bootstrap-3.4.1-dist/css/bootstrap.css" />
    <link rel="stylesheet" href="/static/font-awesome-4.7.0/css/font-awesome.css" />
</head>

<body>

    <!-- 导航栏 -->
    <nav class="navbar navbar-inverse">
        <div class="container">
            <!-- Brand and toggle get grouped for better mobile display -->
            <div class="navbar-header">
                <button type="button" class="navbar-toggle collapsed" data-toggle="collapse"
                    data-target="#bs-example-navbar-collapse-1" aria-expanded="false">
                    <span class="sr-only">Toggle navigation</span>
                    <span class="icon-bar"></span>
                    <span class="icon-bar"></span>
                    <span class="icon-bar"></span>
                </button>
                <a class="navbar-brand">水源社区</a>
            </div>

            <!-- Collect the nav links, forms, and other content for toggling -->
            <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
                <ul class="nav navbar-nav">
                    <li class="active">
                        <a href="#">客服<span class="sr-only">(current)</span>
                        </a>
                    </li>
                    <li>
                        <a href="#">加入我们</a>
                    </li>
                </ul>
                <form class="navbar-form navbar-left">
                    <div class="form-group">
                        <input type="text" class="form-control" placeholder="请输入内容...">
                    </div>
                    <button type="submit" class="btn btn-default">搜索</button>
                </form>
                <ul class="nav navbar-nav navbar-right">
                    {% if g.user %}
                    <li class="active">
                        <a href="{{ url_for('blog.create') }}">写文章
                        </a>
                    </li>
                    <li class="dropdown">
                        <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true"
                            aria-expanded="false">
                            {{ g.user['nickname'] }}
                            <span class="caret"></span>
                        </a>
                        <ul class="dropdown-menu">
                            <li>
                                <a href="{{ url_for('auth.logout') }}">退出登录</a>
                            </li>
                            <li role="separator" class="divider"></li>
                            <li>
                                <a href="#">消息通知</a>
                            </li>
                        </ul>
                    </li>
                    {% else %}
                    <li>
                        <a href="{{ url_for('auth.register') }}">注册</a>
                    </li>
                    <li>
                        <a href="{{ url_for('auth.login') }}">登录</a>
                    </li>
                    {% endif %}


                </ul>
            </div><!-- /.navbar-collapse -->
        </div><!-- /.container-fluid -->
    </nav>

    <div class="container">
        <!-- 文章主体 -->
        <div class="page-header">
            <h1>{{ article_author['title'] }} <small>{{ article_author['nickname'] }}</small>
            </h1>
        </div>

        <!-- 父评论 -->
        <div class="page-header">
            <h1>原始评论 <small style="color:green;"> 共计{{ num_parent_comments }}条 </small></h1>
        </div>
        <div class="page-header">
            {% for comment in parent_comments %}
            <div class="media page-header">
                <div class="media-body">
                    <h4 class="media-heading">
                        {% if not loop.last %}
                        <span style="color: gray;">{{ comment['nickname'] }}</span>
                        于<span style="color: orange;">
                            {{ comment['last_modified_time'] }}
                        </span>
                        {% else %}
                        <span style="font-weight: bold;">{{ comment['nickname'] }}</span>
                        于
                        <span style="color:red;">
                            {{ comment['last_modified_time'] }}
                        </span>
                        {% endif %}
                        回复
                        <span style="color: gray;">
                            {% if comment['parent_nickname'] %}
                            {{ comment['parent_nickname'] }}
                            {% else %}
                            原文《{{ article_author['title'] }}》
                            {% endif %}
                        </span>
                    </h4>
                    {{ comment['content'] }}
                    <a href="{{ url_for('comment.detail', ID=comment['numberID']) }}">查看回复</a>
                    <a href="{{ url_for('comment.create', prevID=comment['numberID']) }}">回复ta</a>
                </div>
            </div>
            {% endfor %}
        </div>

        <!-- 子树评论 -->
        <div class="page-header">
            <h1>相关回复<small style="color:green;"> 共计{{ num_tree_comments }}条 </small></h1>
        </div>
        {% for comment in tree_comments %}
        <div class="media page-header">
            <div class="media-body">
                <h4 class="media-heading"> {{ comment['nickname'] }} 于
                    <span style="color: blue;">
                        {{ comment['last_modified_time'] }}
                    </span>
                    回复
                    <span style="color: gray;">
                        {% if comment['parent_nickname'] %}
                        {{ comment['parent_nickname'] }}
                        {% else %}
                        原文《{{ article_author['title'] }}》
                        {% endif %}
                    </span>
                </h4>
                {{ comment['content'] }}
                <a href="{{ url_for('comment.detail', ID=comment['numberID']) }}">查看回复</a>
                <a href="{{ url_for('comment.create', prevID=comment['numberID']) }}">回复ta</a>
            </div>
        </div>
        {% endfor %}




    </div>

    <!-- 使用boot strap & font awesome -->
    <script src="/static/jquery/jquery-3.6.3.min.js"></script>
    <script src="/static/bootstrap-3.4.1-dist/js/bootstrap.min.js"></script>

</body>

</html>